package com.ruoyi.web.controller.system;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TenantInfo;
import com.ruoyi.system.service.TenantlnfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/reserve")
public class TenantInfoController extends BaseController {

    @Autowired
    private TenantlnfoService tenantlnfoService;

    /**
     * 提交租房人信息（预约看房）
     */
    @PostMapping("/reserve")
    @Log(title = "租房管理", businessType = BusinessType.INSERT)
    public AjaxResult submitReserve(@RequestBody TenantInfo tenantInfo) {
        boolean success = tenantlnfoService.saveTenantInfo(tenantInfo);
        if (success) {
            return AjaxResult.success("预约成功");
        } else {
            return AjaxResult.error("预约失败，请稍后再试");
        }
    }
}